﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Master/AdminMaster.Master" AutoEventWireup="true"
    CodeBehind="BidProductCompany.aspx.cs" Inherits="HZ.DrugTrade.Web.Admin.BidProdManage.BidProductCompany"
    Title="无标题页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript" language="javascript">
        function insertCompanyInfo(companyInfo) {
            var varCompanyInfo = companyInfo.split('|');
            
            var companyNames=varCompanyInfo[0];
            var companyIDs=varCompanyInfo[1];  
                      
            var listbox=document.getElementById("ctl00_ContentPlaceHolder1_lstCompanyName");
            var companyID=document.getElementById("ctl00_ContentPlaceHolder1_companyId");
            var companyName=document.getElementById("ctl00_ContentPlaceHolder1_hfdCompanyName");   
            companyID.value="";
            companyName.value="";  
                        
            var arrayName=companyNames.split(',');
            var arrayID=companyIDs.split(',');
            
            var isUnique=true;
            var temp;
            for(m=0;m<arrayID.length;m++)
            {
               for(n=0;n<listbox.options.length;n++)
               {
                  if(arrayID[m]==listbox.options[n].value)
                  {
                     isUnique=false;
                     temp=arrayName[m];
                     break;
                  }
               }
            }
            
            if(isUnique==true)
            {
                for(var i=0;i<arrayName.length;i++)
                {
                    if(!isNull(arrayName[i]))
                    {
                        var listItem=document.createElement("OPTION");
                        listItem.text=arrayName[i];
                        listItem.value=arrayID[i];
                        listbox.add(listItem);
                    }
                }
            }
            else
            {
                alert("企业"+temp+"已经存在！");
                return;
            }
            
            for(j=listbox.options.length-1;j>=0;j--)
            {
                companyID.value=companyID.value+listbox[j].value+",";
                companyName.value=companyName.value+listbox[j].text+",";
            }
        }
        
        function deleteCompany(){
             if(!isNull(checkSelected()))
             {
                 var info=checkSelected();
                 alert(info);
                 return;
             }
             var listbox=document.getElementById("ctl00_ContentPlaceHolder1_lstCompanyName");
             var companyID=document.getElementById("ctl00_ContentPlaceHolder1_companyId");
             var companyName=document.getElementById("ctl00_ContentPlaceHolder1_hfdCompanyName");
             companyID.value="";
             companyName.value="";
             
             var selectindex=listbox.selectedIndex;
             listbox.remove(selectindex);
            
             for(j=listbox.options.length-1;j>=0;j--)
             {
                companyID.value=companyID.value+listbox[j].value+",";
                companyName.value=companyName.value+listbox[j].text+",";
             }
        }
        
        function checkSelected()
        {
            var info;
            var listbox=document.getElementById("ctl00_ContentPlaceHolder1_lstCompanyName");
            var selectindex=listbox.selectedIndex;
            if(selectindex<0)
            {
               info="请选择要删除的企业！";
               return info;
            }
            return "";
        }
        
        function isNull(str)
        {
           var re=/^[ \s]*$/;
           return re.test(str);
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="maincon">
        <div id="note">
            查看产品配送企业</div>
        <div id="note2">
        </div>
        <table>
            <tr>
                <th align="right">
                    <asp:Label ID="lblGoodsName" runat="server" Text="产品名称："></asp:Label>
                </th>
                <td align="left" colspan="2">
                    <asp:Label ID="txtGoodsName" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <th align="right">
                    <asp:Label ID="lblCompany_SC" runat="server" Text="生产企业："></asp:Label>
                </th>
                <td align="left" colspan="2">
                    <asp:Label ID="txtCompany_SC" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <th align="right">
                    <asp:Label ID="lblCompany_TB" runat="server" Text="投标企业："></asp:Label>
                </th>
                <td align="left" colspan="2">
                    <asp:Label ID="txtCompany_TB" runat="server"></asp:Label>
                </td>
            </tr>
            <%--<tr>
                <th align="right">
                    <asp:Label ID="lblSortSource" runat="server" Text="产品来源："></asp:Label>
                </th>
                <td align="left" colspan="2">
                    <asp:Label ID="txtSortSource" runat="server"></asp:Label>
                </td>
            </tr>--%>
            <tr>
                <th align="right">
                    <asp:Label ID="lblProjectName" runat="server" Text="产品所属项目："></asp:Label>
                </th>
                <td align="left" colspan="2">
                    <asp:Label ID="txtProject" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <th align="right">
                    <asp:Label ID="lblProcurePrice" runat="server" Text="采购限价："></asp:Label>
                </th>
                <td align="left" colspan="2">
                    <asp:Label ID="txtProcurePrice" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <th align="right">
                    <asp:Label ID="lblCompany_PS" runat="server" Text="配送企业："></asp:Label>
                </th>
                <td align="left" width="250px">
                    <input id="companyId" type="hidden" name="companyId" runat="server" />
                    &nbsp;<asp:ListBox ID="lstCompanyName" runat="server" Height="180px" Width="250px">
                    </asp:ListBox>
                    <input id="hfdCompanyName" type="hidden" name="hfdCompanyName" runat="server" />
                    &nbsp;
                </td>
                <td align="left">
                    <input id="btnCompanySelect" type="button" value="增加企业" class="btn" onclick="window.open('CompanySelect.aspx','selectCompany','width=300,height=400,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')" />
                    <br />
                    <input id="btnCompanyDelete" type="button" value="删除企业" class="btn" onclick="deleteCompany()" />
                </td>
            </tr>
        </table>
    </div>
    <div class="listip">
        <ul>
            <li>提示:<span style="color: #ff0000"> 配送企业修改后请“保存”。</span></li>
        </ul>
    </div>
    <div class="listctrl">
        <hz:HzButton ID="btnUpdate" runat="server" Text="保存" OnClick="btnUpdate_Click" CssClass="btn" />
        &nbsp;<input type="button" value="返回" onclick="javascript:history.go(-1)" class="btn" />
    </div>
</asp:Content>
